$(function () {
    //获取用户信息
    function getUserInfo() {
        $.ajax({
            url: "/admin/user/info",
            type: 'get',
            headers: { Authorization: localStorage.getItem("token") },
            success(res) {
                console.log(res);
                $('.user_info img').prop('src', res.data.userPic)
                $('.user_info b').text(res.data.nickname)
                $('.user_center_link img').prop('src', res.data.userPic)
            }

        })
    }

    getUserInfo()
    $('.logout').on('click', function () {
        layer.confirm('是否要退出?', { icon: 3, title: '提示' }, function (index) {
            //do something
            localStorage.removeItem('token')
            location.href = 'login.html'
            layer.close(index);
        })
    })

    $('.level01').on('click', function () {
        $(this).toggleClass('active').siblings().removeClass('active')
        $('.level02').stop().slideToggle()
        $('.icon-arrowdownl').toggleClass("rotate0")
    })
    $('.level02 li').on('click', function () {
        $(this).toggleClass('active').siblings().removeClass('active')
    })

})